# Maintainer: Jacek Pruciak <pmos@juniorjpdj.pl>
pkgname=u-boot-lark-freeme-70-2s
pkgver=2021.01
pkgrel=1
pkgdesc="u-boot for Lark FreeMe 70.2s"
url="https://www.denx.de/wiki/U-Boot/"
arch="armv7"
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs
	ISC LGPL-2.0-only LGPL-2.1-only X11"
options="!check" # no tests in upstream
makedepends="$depends_dev bc dtc python3-dev swig bison flex openssl-dev
	py3-setuptools linux-headers"
# https://github.com/megous/linux/tree/orange-pi-5.12#kernel-lockup-issues
source="
	https://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2
	0001-sunxi-h3-Fix-PLL1-setup-to-never-use-dividers.patch
	0002-dts-add-sun4i-a10-lark-freeme-70-2s.patch
	0003-configs-add-lark-freeme-70-2s.patch
	"
builddir="$srcdir"/u-boot-${pkgver//_/-}

build() {
	touch include/config.h
	LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > include/timestamp_autogenerated.h
	LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> include/timestamp_autogenerated.h

	make lark-freeme-70-2s_config
	make all
}

package() {
	install -D -m644 "$builddir"/u-boot-sunxi-with-spl.bin \
		"$pkgdir"/usr/share/u-boot/lark-freeme-70-2s/u-boot-sunxi-with-spl.bin
}

sha512sums="40dd4d9ef87a1829158658c433d46a047a39c0d8c314ad8d133f7240343ee3a75b060f009dd2efe598cfb8a766773f6cd773ea7f7745ee88e52a771c77eb1c6e  u-boot-2021.01.tar.bz2
9478a5b46414139212a11d29e05dd973c4c866e8970b25021517d47b7177a03c910dbe761ae9c5acee0e4f1a5a8db76f24e168b83a5ebd9034d9cb640350604e  0001-sunxi-h3-Fix-PLL1-setup-to-never-use-dividers.patch
e1317ba266d8d615dfae41e6d57056b8cbb7a84df910b80f39b9b1e7737e0b1769943259ddd4637ded7412a18097a565b12b359313b566d85799ac28bf141c23  0002-dts-add-sun4i-a10-lark-freeme-70-2s.patch
113ca6677fc6bf30f95b830f4da962a6acf7e64a7b7e0ffd76f5a3e1a861f7fdd68d8cecd61eda9b438612a9e165228eb061b9e7b2b02f38a41eedd831c83f37  0003-configs-add-lark-freeme-70-2s.patch"
